package com.shenzhenai.dn_compose_learn

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview

/**
 *
 * 03-Composable 函数与预览
 *
 * https://www.bilibili.com/video/BV1ob4y1a7ad?spm_id_from=333.788.player.switch&vd_source=e07cc8cc94eb22bd76722071b03cd199&p=3
 */
class MainActivity02 : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContent {
            MessageCard(name = "My Android")
        }
    }


    @Composable
    fun MessageCard(name: String) {
        Text(text = "Hello, ${name}")
    }

    @Preview
    @Composable
    fun PreviewMessageCard() {
        MessageCard(name = "My Android")
    }

}
